import {
	RouterMount,
	createRouter
} from 'uni-simple-router';
const router = createRouter({
	platform: process.env.VUE_APP_PLATFORM,
	routes: [...ROUTES]

});
//全局路由前置守卫
router.beforeEach((to, from, next) => {
	console.log(to.meta.title, "55555")
	//权限控制登录
	if (to.meta.title) {
		console.log("需要登录");
		// uni.reLaunch({url:'/pages/pages/index'})
		if ("token") {
			next();
		} else {
			console.log("请登录");
		}
	} else {
		console.log("不需要登录");
		next();
	}

	console.log("前置守卫" + JSON.stringify(to));

});
// 全局路由后置守卫
router.afterEach((to, from) => {
	console.log('跳转结束')
})

export {
	router,
	RouterMount
}
